﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ENG.PSSAirbusSoundExtender
{
  public partial class OnOffLight : UserControl
  {
    private const int SIZE = 24;

    public OnOffLight()
    {
      InitializeComponent();
    }

    private bool isMyResize = false;
    private void OnOffLight_Resize(object sender, EventArgs e)
    {
      if (isMyResize) return;
      if ((this.Width != SIZE) || (this.Height != SIZE))
      {
        isMyResize = true;
        this.Width = SIZE;
        this.Height = SIZE;
        isMyResize = false;
      }
    }

      public ASystem.eStatus Value 
      { 
        get
      {
        if (picOn.Visible)
          return ASystem.eStatus.On;
        else if (picUnpowered.Visible)
          return ASystem.eStatus.Unpowered;
        else
          return ASystem.eStatus.Off;
        }
        set
        {
          picOn.Visible = false;
          picOff.Visible = false;
          picUnpowered.Visible = false;

          if (value == ASystem.eStatus.On)
            picOn.Visible = true;
          else if (value == ASystem.eStatus.Unpowered)
            picUnpowered.Visible = true;
          else
            picOff.Visible = true;
        } 
      }
    }
  }
